<%--
  Created by IntelliJ IDEA.
  User: lenovo
  Date: 2018/7/17
  Time: 15:18
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<div class="container-fluid">
    相册添加
    <form id="album-form-add" name="albumForm" enctype="multipart/form-data" method="post" >
        <fieldset>
            <div class="form-group">
                <label class="label">相册名称</label>
                <input type="text" name="name" class="form-control" placeholder="用户名称" />
            </div>
            <div class="form-group">
                <label class="label">描述</label>
                <textarea class="form-control" rows="3" name="description" placeholder="描述"></textarea>
                <%--<textarea size="500" cols="40" rows="10" placeholder="" ></textarea>--%>
            </div>
            <button type="button" class="btn btn-primary" id="album_btn_save">保 存</button>
        </fieldset>
    </form>
    <script type="application/javascript">

        /**
         * 保存按钮
         */
        $('#album_btn_save').on('click', function () {

            var _this = this;
            var data = $('#album-form-add').serializeArray();
            var params = {};
            for (index in data) {
                params[data[index].name] = data[index].value;
            }
            $(_this).html('<i class="icon icon-spin icon-spinner-snake"></i>正在保存……')
            $('#album-form-add fieldset').attr('disabled', true);
            $.post('/admin/activity/album/save', params, function (res) {
                if(res.code == 200 && res.status){
                    new $.zui.Messager('保存成功。', {
                        type: 'success',
                        icon: 'check',//smile
                        close: true,
                        time: 0,
                        placement: 'center' // 定义显示位置
                    }).show();
                    setTimeout(function () {
                        // 页面跳转
                        $('body').hrefClick('/admin/activity/album/index');
                    }, 2000);
                }else{
                    new $.zui.Messager('保存失败，请检查或修改内容后重试。', {
                        type: 'danger',
                        icon: 'frown',//smile
                        close: true,
                        placement: 'center' // 定义显示位置
                    }).show();
                    $(_this).html('保 存');
                    $('#resource-form-add fieldset').attr('disabled', false);
                }
            });
        });

    </script>
</div>